/*
 * @Author: LBH 1336709799@qq.com
 * @Date: 2024-11-22 20:44:03
 * @LastEditors: LBH 1336709799@qq.com
 * @LastEditTime: 2024-12-04 10:49:34
 * @FilePath: \vue-admin\src\api\user.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import service from '@/utils/request'

// 登录函数
/**
 * @description: 登录函数
 * @param {*} data { mobile,password}
 * @return {*} promise
 */
export function loginAPI({ username, password }) {
  return service({
    url: '/park/login',
    method: 'POST',
    data: {
      username,
      password
    }
  })
}
export function getCardListAPI(params) {
  return service({
    url: '/parking/card/list',
    params
  })
}

/**
 * 新增月卡
 * @data
 * @returns
 */
export function createCardAPI(data) {
  return service({
    url: '/parking/card',
    method: 'POST',
    data
  })
}

/**
 * 获取月卡详情
 * @data
 * @returns
 */
export function getCardDetailAPI(id) {
  return service({
    url: `/parking/card/detail/${id}`
  })
}

export function updateCardAPI(data) {
  return service({
    url: '/parking/card/edit',
    method: 'PUT',
    data
  })
}

/**
 * 删除月卡
 * @param {*} id
 * @returns
 */
export function delCardAPI(id) {
  return service({
    url: `/parking/card/${id}`,
    method: 'DELETE'
  })
}

/**
 * 删除月卡
 * @param {*} id
 * @returns
 */
export function delCardListAPI(idList) {
  return service({
    url: `/parking/card/${idList.join(',')}`,
    method: 'DELETE'
  })
}

/**
 * @description: 获取用户信息
 * @param {*} data {}
 * @return {*} promise
 */
export function getProfileAPI() {
  return service({
    url: '/park/user/profile',
    method: 'GET'
  })
}

